<script setup lang="ts">
import { ref } from 'vue';

const tours = ref([
  {
    id: 1,
    title: '巴厘岛豪华度假之旅',
    image: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.LvmAiLB0Zkk8P3QAwGTBTAHaE8?rs=1&pid=ImgDetMain',
    days: '6天5晚',
    features: '含SPA、游艇及文化体验',
    rating: 4.9,
    price: '¥ 9,999'
  },
  {
    id: 2,
    title: '欧洲古堡浪漫之旅',
    image: 'https://ts1.tc.mm.bing.net/th/id/R-C.d457a2a9f08f61306bd88aed24c02f95?rik=rlsKH6IxdW3ryw&riu=http%3a%2f%2fp0.ifengimg.com%2fhaina%2f2016_20%2f0a5da499c308cd9_w1024_h682.jpg&ehk=dvf%2bQK7%2f1b7Ak5Ae1V0jiep9peJXgaJe7Rpg0DPhN%2b0%3d&risl=&pid=ImgRaw&r=0',
    days: '10天9晚',
    features: '探索中世纪城堡，品味欧洲文化',
    rating: 4.8,
    price: '¥ 19,999'
  },
  {
    id: 3,
    title: '日本温泉赏樱之旅',
    image: 'https://img1.qunarzz.com/travel/d6/1801/38/860b59a60f505ab5.jpg_r_1360x1360x95_5a3be5ab.jpg',
    days: '7天6晚',
    features: '体验日式温泉，观赏樱花盛景',
    rating: 4.7,
    price: '¥ 12,999'
  }
]);
</script>

<template>
  <section>
    <h2 class="section-title">精选旅游产品</h2>
    <div class="tour-grid">
      <div v-for="tour in tours" :key="tour.id" class="tour-card">
        <div class="tour-image">
          <img :src="tour.image" :alt="tour.title" />
          <div class="tour-rating">
            <span class="star">★</span>
            <span>{{ tour.rating }}</span>
          </div>
        </div>
        <div class="tour-info">
          <h3 class="tour-title">{{ tour.title }}</h3>
          <div class="tour-details">
            <div class="tour-duration">
              <span class="icon">🕒</span>
              <span>{{ tour.days }}</span>
            </div>
            <div class="tour-features">{{ tour.features }}</div>
          </div>
          <div class="tour-footer">
            <div class="tour-price">{{ tour.price }} 起</div>
            <button class="book-now-btn">立即预订</button>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>

<style scoped>
.section-title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin: 50px 0 30px;
}

.tour-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

.tour-card {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background-color: white;
}

.tour-image {
  position: relative;
  height: 200px;
}

.tour-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tour-rating {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: white;
  border-radius: 15px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: bold;
}

.star {
  color: #ffcc00;
}

.tour-info {
  padding: 15px;
}

.tour-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.tour-details {
  margin-bottom: 15px;
}

.tour-duration {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.icon {
  color: #666;
}

.tour-features {
  color: #666;
  font-size: 14px;
}

.tour-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.tour-price {
  color: #ff3b30;
  font-weight: bold;
}

.book-now-btn {
  background-color: #0066cc;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.book-now-btn:hover {
  background-color: #0055aa;
}
</style>